//MySQL

#$
//连接数据库
$conn=new mysqli(HOST,USER,PWD);
#$
//判断是否连接成功
if($conn->connect_errno){}
#$
//选择数据库
$conn->select_db("mysjk");
#$
//打印错误信息
$conn->content_error;
#$
//查询语句select,where条件查询
$result = $conn->query("SELECT * FROM 表 WHERE userName='$userName'");
#$
//
$result =$conn->query("SELECT * FROM user WHERE userName='$user'");
//var_dump($result)	；	 
 if ($result->num_rows > 0) {
		 exit("用户名已存在");
		 }
#$
//insert添加信息
$sql="INSERT INTO 表(列1,列2,..)values('$值1','值2',...)";
#$
//注册数据表sql
id int(11) not null primary key auto_increment,nickname varchar(255) not null,username varchar(255) not null unique,password varchar(255) not null,zhucetime datetime not null,lasttime datetime not null
#$

//多表查询
$sql="SELECT members.id,consumption.consu_ordernumber,consumption.consu_classify,k3.number,k3.order_money,k3.k3_expect,k3.infuse FROM members LEFT JOIN consumption ON members.id=consumption.members_id LEFT JOIN k3 ON members.id=k3.members_id where members.id = $id AND consumption.consu_ordernumber = k3.k3_ordernumber";

